package jmine.tec.datadigester.positional.checker.types;

import java.lang.reflect.Method;

import jmine.tec.datadigester.positional.annotations.PositionalDateEntry;
import jmine.tec.datadigester.positional.checker.PositionalTypeChecker;
import jmine.tec.datadigester.positional.checker.PositionalTypeRange;

/**
 * @author israel.crisanto
 */
public class DatePositionalTypeChecker implements PositionalTypeChecker<PositionalDateEntry> {

    public boolean verifyIfMethodIsOk(Method method) {
        boolean isValid = false;

        if (method.getParameterTypes().length == 1) {
            if ((method.getParameterTypes()[0] != bancosys.tec.utils.date.Date.class)
                    || (method.getParameterTypes()[0] != java.util.Date.class)) {
                isValid = true;
            }
        }

        return isValid;
    }

    public PositionalTypeRange getRange(PositionalDateEntry annotation, Method method) {
        return new PositionalTypeRange(method, annotation.start(), annotation.size());
    }

}
